home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows Surprise 3
/
Windows Surprise 3.iso
/
defen.140
/
custom
/
demo.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-25
|
2KB
|
110 lines
// demo.h
#ifndef _demo_h
#define _demo_h
// user this structure to pass information to the main program
struct DemoInfo
{
char *Target;
int Version;
char *DemoName;
char *HiScoreEntry;
};
// receive information on game objects in this structure
struct GameObject
{
int Flags,Type,User;
int x,y,w,h;
long xv,yv;
BOOL Valid;
};
// receive other information in these structures and pass back controls
union Controls
{
BYTE byte;
struct BITS
{
BYTE Up:1;
BYTE Down:1;
BYTE Thrust:1;
BYTE Dir:1;
BYTE Fire:1;
BYTE Smart:1;
BYTE Hyperspace:1;
} bits;
};
struct GameInfo
{
int Lives,SmartBombs;
DWORD Score,Frame;
BYTE *Landscape;
BOOL Scape;
GameObject Ship;
Controls *C;
};
typedef void (CALLBACK *DemoProc)(GameObject *);
extern "C" // prevent name mangling
{
DemoInfo * _export CALLBACK Initialize(DemoProc F,DemoProc N);
void _export CALLBACK ControlDemo(GameInfo*);
void _export CALLBACK GameInit();
void _export CALLBACK GameOver(DWORD,WORD);
}
// game object type in GameObject.Type
#ifndef _OBJECTS
enum {SHIP1=0,HUMANOID,LANDER,MUTANT,PULSAR,POD,PODBIT,BAITER,
LASER,BULLET,PULSBUL};
#define _OBJECTS
#endif
// general macros ***************************
// planet size
#define PSIZE 4096
// mask for planet size
#define XMASK 0xfff
// xv,yv are stores as pixels per frame << LSH
#define LSH 20
// get signed integer x-coordinate value
#ifdef WIN32
#define SIGNX(x) (((int)(x)<<LSH)>>LSH)
#else
#define SIGNX(x) (((int)(x)<<(LSH-16))>>(LSH-16))
#endif
// test if -r<x<r
#define INRANGE(x,r) ((WORD) ( (x) +r)<2*r)
// object flags in GameObject.Flags
#define O_DEAD 1
#define O_MATERIALISE 2
#define O_SMALLWEAP 4
#define O_EXPL 8
#define O_SHIP 16
// humanoid states in GameObject.User when Type==HUMANOID
#define H_NORM 0
#define H_HELD 1
#define H_FALLING 2
// lander states in GameObject.User when Type==LANDER
#define L_NORM 0
#define L_GRABBING 1
#define L_LIFTING 2
// Demo mode interface version
#define VERSION 0x100
#endif